/**
 * 
 */
$.widget("ui.dialog", 
	$.extend({}, $.ui.dialog.prototype, 
		{
			
			success: function(opt){
				$("<div'>"+opt.message+"</div>")
				.appendTo( this.uiDialog.find(".ui-dialog-content"));
				
				this._setOptions($.extend({}, this.options, { 
					width: 240,
					modal: true,
					// title: "<div class='widget-header widget-header-small'><h4 class='smaller'><i class='ace-icon fa fa-check'></i> "+opt.title+"</h4></div>",
					title_html: true,
					buttons: [						
						{
							html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp;确认",
							"class" : "btn btn-white btn-primary btn-round btn-xs",
							click: function() {
								$( this ).dialog( "close" ); 
							} 
						}
					]
				}));
				
				
				
				var ttl = "<div class='widget-header'><h4 class='smaller blue'><i class='ace-icon fa fa-check-circle green'></i>&nbsp;" + opt.title + "</h4></div>";
				this.uiDialogTitlebar.find(".ui-dialog-title").html(ttl);
				
				//this.open();
			}, 
 
			info: function(opt){
				$("<p>"+opt.message+"</p>")
				.appendTo( this.uiDialog.find(".ui-dialog-content"));
				
				this._setOptions($.extend({}, this.options, { 
					width: 240,
					modal: true,
					// title: "<div class='widget-header widget-header-small'><h4 class='smaller'><i class='ace-icon fa fa-check'></i> "+opt.title+"</h4></div>",
					title_html: true,
					buttons: [						
						{
							html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp;确认",
							"class" : "btn btn-white btn-primary btn-round btn-xs",
							click: function() {
								$( this ).dialog( "close" ); 
							} 
						}
					]
				}));
				
				
				
				var ttl = "<div class='widget-header'><h4 class='smaller blue'><i class='ace-icon fa fa-info-circle bule'></i>&nbsp;" + opt.title + "</h4></div>";
				this.uiDialogTitlebar.find(".ui-dialog-title").html(ttl);
				
				//this.open();
			},
			
			
			warning: function(opt){
				 
				$("<p>"+opt.message+"</p>")
				.appendTo( this.uiDialog.find(".ui-dialog-content"));
				
				this._setOptions($.extend({}, this.options, { 
					width: 240,
					modal: true,
					// title: "<div class='widget-header widget-header-small'><h4 class='smaller'><i class='ace-icon fa fa-check'></i> "+opt.title+"</h4></div>",
					title_html: true,
					buttons: [						
						{
							html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp;确认",
							"class" : "btn btn-white btn-primary btn-round btn-xs",
							click: function() {
								$( this ).dialog( "close" ); 
							} 
						}
					]
				}));
				
				
				
				var ttl = "<div class='widget-header'><h4 class='smaller blue'><i class='ace-icon fa fa-warning orange'></i>&nbsp;" + opt.title + "</h4></div>";
				this.uiDialogTitlebar.find(".ui-dialog-title").html(ttl);
				
				//this.open();
			},
			
			error: function(opt){
				 
				$("<p>"+opt.message+"</p>")
				.appendTo( this.uiDialog.find(".ui-dialog-content"));
				
				this._setOptions($.extend({}, this.options, { 
					width: 240,
					modal: true,
					// title: "<div class='widget-header widget-header-small'><h4 class='smaller'><i class='ace-icon fa fa-check'></i> "+opt.title+"</h4></div>",
					title_html: true,
					buttons: [						
						{
							html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp;确认",
							"class" : "btn btn-white btn-primary btn-round btn-xs",
							click: function() {
								$( this ).dialog( "close" ); 
							} 
						}
					]
				}));
				
				
				
				var ttl = "<div class='widget-header'><h4 class='smaller red'><i class='ace-icon fa fa-exclamation-circle red'></i>&nbsp;" + opt.title + "</h4></div>";
				this.uiDialogTitlebar.find(".ui-dialog-title").html(ttl);
				
				//this.open();
			},
			
			confirm: function(opt){   
				
				$("<p>&nbsp;"+opt.message+"</p>")
				.appendTo( this.uiDialog.find(".ui-dialog-content"));
				
				this._setOptions($.extend({}, this.options, {
					width: 240,
					modal: true,
					//title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-exclamation-triangle red'></i>&nbsp;" + opt.title + "</h4></div>",
					title_html: true,
					buttons: [
						{
							html: "<i class='ace-icon fa fa-check'></i>&nbsp;确认",
							"class" : "btn btn-white btn-danger btn-round btn-xs",
							id: "btn-ok",
							click: function() {
								if (opt.callback && opt.callback instanceof Function) {
									opt.callback(opt.param);
								}
								$(this).dialog( "close" );
							}
						}
						,
						{
							html: "<i class='ace-icon fa fa-times'></i>&nbsp;取消",
							"class" : "btn btn-white btn-default btn-round btn-xs",
							id: "btn-cancel",
							click: function() {
								$(this).dialog( "close" );
							}
						}
					]
				}));
				
				
				
				var ttl = "<div class='widget-header'><h4 class='smaller blue'><i class='ace-icon fa fa-warning orange'></i>&nbsp;" + opt.title + "</h4></div>";
				this.uiDialogTitlebar.find(".ui-dialog-title").html(ttl);
				
				//this.open();
			},
			
			select: function(opt){   
				
				$("<p>"+opt.message+"</p>")
				.appendTo( this.uiDialog.find(".ui-dialog-content"));
				
				this._setOptions($.extend({}, this.options, { 
					modal: true,
					//title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-exclamation-triangle red'></i>&nbsp;" + opt.title + "</h4></div>",
					title_html: true,
					buttons: [
						    
						{
							html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp;确认",
							"class" : "btn btn-white btn-success btn-round btn-xs",
							click: function() {
								if (opt.callback && opt.callback instanceof Function) {
									opt.callback(opt.param);
								}
								$(this).dialog( "close" );
							}
						}
						,
						{
							html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp;取消",
							"class" : "btn btn-white btn-default btn-round btn-xs",
							click: function() {
								$(this).dialog( "close" );
							}
						},
						{
							html: "<i class='ace-icon fa fa-reply bigger-110'></i>&nbsp;返回",
							"class" : "btn btn-white btn-primary btn-round btn-xs",
							click: function() { 
								$(this).dialog( "close" );
							}
						}  
						
					]
				}));
				
				
				
				var ttl = "<div class='widget-header'><h4 class='smaller blue'><i class='ace-icon fa fa-info-circle blue'></i>&nbsp;" + opt.title + "</h4></div>";
				this.uiDialogTitlebar.find(".ui-dialog-title").html(ttl);
				
				//this.open();
			}
		})
);